package com.wxy.controller;

import com.wxy.dao.UserMapper;
import com.wxy.domain.R;
import com.wxy.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 47868
 */
@Controller
@RequestMapping("rtest")
public class RtestController {
    private final UserMapper userMapper;
    @Autowired
    public RtestController(UserMapper userMapper) {
        this.userMapper = userMapper;
    }

    @RequestMapping("test")
    public String test() {
        return "Rtest";
    }

    @RequestMapping("getAll")
    @ResponseBody
    public R getAll(){
        try {
            int i=1/0;
        }
        catch (ArithmeticException e) {
            return R.error(500,e.getMessage());
        }
        return R.ok("成功",userMapper.findAll());
    }
}
